{template 'header'}

<link rel="stylesheet" type="text/css" href="/plugins/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="{DT_SKIN}style.css"/>
<link href="{DT_SKIN}style4.css" type="text/css" rel="stylesheet"/>
<link rel="stylesheet" type="text/css" href="/plugins/bootstrap/css/bootstrap-dropdown-checkbox.css" />
<script src="/plugins/bootstrap/js/bootstrap-dropdown-checkbox.js"></script>

<style>
    body {
        font-size:12px;
    }
    
    .nav {
        /* width: 1003px; */
        height: 44px;
        line-height: 44px;
        font-size: 14px;
        font-weight: bold;
        color: #FFF;
        /* background: url(/skin/default/image/nav_03.jpg) repeat-x left bottom; */
        background-color: #1d75d9;
        margin: 0 auto;
        padding: 0 10px 0 10px;
    }
    
    /** {
        -webkit-box-sizing: initial;
        -moz-box-sizing:    initial;
        box-sizing:         initial;
    }*/
    
  /*  .anniu {
        width:90px; 
        height:33px;
        padding:1px 6px;
    }*/
    
    .renzheng1 {
        WIDTH: 144px;
        FLOAT: left;
        margin:0px;
        margin-left: 45px;
        margin-top: 5px;
    }
    
    .search-item{
           width:79.4%;
           height:123px;
           float:left;
           padding-top:5px;
           border:#e8e8e8 solid 1px; border-top:none;
       }
        
       .search-item-btn{          
           text-align:center;
       }
       
       .search-item-btn .btn {
            margin: 13px auto;
            width: 80%;  
            height: 100px;
            border: solid 1px #e8e8e8;
            color: white;
            background: #3d95e6;
            font-size: 16px;
            font-weight: bolder;
       }
       
       .search-item-btn .btn:hover {
            margin: 13px auto;
            width: 80%;
            //border-width: 1px;
            border: solid 1px #e8e8e8;
            color: white;
            background: #3da6e6;
            font-size: 16px;
            font-weight: bolder;
       }
       label{
           font-weight:normal;
       }
       .piaochecked {
            border:solid 1px #a9a9a9;
            border-radius:3px;           
           /* height: 30px;
           
            float: left;*/
            cursor: pointer;
            margin-right: 10px;
            text-align: center;
            padding-left: 5px;
            padding-right: 5px;            
            margin-top: 5px;
            /*
            margin-bottom: 5px;*/
            display:inline-block;
            
        }
        
        .piaochecked:hover {           
            background-color:#d3dbe7;
            border:solid 1px #a9a9a9;
            border-radius:3px;           
           /* height: 30px;           
            float: left;*/
            cursor: pointer;
            margin-right: 10px;
            text-align: center;
            padding-left: 5px;
            padding-right: 5px;
            margin-top: 5px;/*
            margin-bottom: 5px;*/
            display:inline-block;
        }

        .on_check {            
            background: #3d95e6; 
            color: white;
        }
        
        .on_check:hover {
            background-color:#3da6e6;
        }
        
        .radioclass {
            width: 14px;
            height: 14px;
            cursor:pointer;    
            vertical-align:middle !important; 
            margin-top:0 !important;
            opacity: 0;
            -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
            filter: alpha(opacity=0);
            
        }
        
        
        
        .styled-checkbox {
            opacity: 0;
            filter: alpha(opacity=0);
        }
        .styled-checkbox + label {
            position: relative;
        }
        .styled-checkbox + label:before,
        .lt-ie8 .checkbox-replacement {
            content: '';
            display: inline-block;
            visibility: visible;
            left: 0;
            width: 1em;
            height: 1em;
            margin: 0px 0.3em -3px -1em;
            line-height: 0.6;
            text-align: center;
            /* Put checkbox styles here: */
            border: 1px solid #87a2b3;
        }
        .styled-checkbox:checked + label:before,
        .lt-ie9 .styled-checkbox.checked + label:before {
            content: '✔';
        }
        
        .dropdown-checkbox-toggle {
            text-decoration: none !important;
        }
        
        .dropdown-checkbox-toggle:hover{
            text-decoration: none !important;
        }
        
        .dropdown-checkbox-content {
            border-radius: 0 !important;
            padding: 0 !important;
            border: solid 1px #aaa;
            margin-left:-20px;
        }
        
        .dropdown-checkbox .dropdown-checkbox-content li .layout:hover {
            background: #d3dbe7;
            color: black;
            cursor: pointer;
        }
        
        .dropdown-checkbox ul.dropdown-checkbox-menu {
            padding: 0 !important;
        }
        
        .open{
            padding-left:0px !important;
            padding-top:0px;
        }
        
        table.table-searchitem { width:100%;border:none }        
        table.table-searchitem > tbody > tr > td {  min-height:20px;vertical-align: middle; border:none; }
        table.table-searchitem > tbody > tr > td:first-child { width:80px; }
        
        h3 {margin:5px;}
        .label {display:table-header-group;}
        
        .catlist{
            overflow: hidden;
            border: 1px solid #ffd5b3;
            border-top: 3px solid #fe5100;
            margin-top: 0px;
            padding: 0px 0px 0px 0px;
        }
    
        .catlist .label{       
            color: #fe5100;
            background: #fff1e6;       
        }

        .catlist .label li{       
            float:left;
            height:36px;
            line-height: 36px;
            float: left;    
            text-align: center;
            font-size: 14px;
            font-weight: bold;
            background:#fff1e6;
            border-bottom: 1px solid #ffd5b3;
        }

        .ellipsis {
            overflow: hidden;
            text-overflow: ellipsis;
            display: block;
            white-space: nowrap;
        }

        .cut, .catlist-col1, .catlist-col2, .catlist-col3, .catlist-col4, .catlist-col5 {

            float: left;    
            text-align: center;
            height: 36px;
            line-height: 36px;
            border-bottom: dashed 1px #aaa;
        }
        
        
        <?php 
            if ( !empty($displaySearchPanel) ) {
        ?>
            .catlist-col1 {
                width:52px;
            }
            .cut{
                width:5px;
                color:#cccccc;
            }

            .catlist-col2 {
                width:310px;
                padding-left:14px;
                padding-right:4px;
                text-align: left;
            }
            .catlist-col3 {
                width:108px;
            }
            .catlist-col4 {
                width:73px;
            }
            .catlist-col5 {
                width:146px
            }
           
        
        <?php 
            } else {
        ?>
            .catlist-col1 {
                width:80px;
            }
            .cut{
                width:5px;
                color:#cccccc;
            }

            .catlist-col2 {
                width:435px;
                padding-left:14px;
                padding-right:4px;
                text-align: left;
            }
            .catlist-col3 {
                width:155px;
            }
            .catlist-col4 {
                width:100px;
            }
            .catlist-col5 {
                width:205px
            }
           
        <?php 
            }
        ?>

         .catlist_last {
                border-bottom: 0 !important;
            }
            
         .pos{
            //width: 700px;
            height: 36px;
            line-height: 36px;
            background: transparent;
        }
        .pos a{
                color: #fe5100;
                font-size: 12px;            
        }
       
        .box_head, .box_body{
            border: 1px #FFD5B3 solid;
            background: none;
            color: #f53200;
            font-size: 14px;
        }
        .box_body{
            border-top: none;
        }
        .box_head{
            border-bottom: none;
            background: #fff1e6 none repeat scroll 0 0;
            color: #fe5100;
            border-color: #fe5100 #ffd5b3 #ffd5b3;
            border-width: 3px 1px 1px;
        }

        a:link{
            color: #666;
            font-size: 12px;
        }
  
        .dropdown-checkbox-content {
            border-radius: 0 !important;
            padding: 0 !important;
            border: solid 1px #aaa;
            margin-left: -5px;
        }
        
        .fsearch {
            padding: 0px;
            margin: 1px;
            background: #F5FAFE url(/skin/default/image/fsearch_bg.gif) repeat-x;
        }
        
        .box_head, .box_body{
        border: 1px #FFD5B3 solid;
        background: none;
        color: #f53200;
        font-size: 14px;
    }
    
    .pos{
            //width: 700px;
            height: 36px;
            line-height: 36px;
            background: transparent;
    }
    .pos a{
            color: #fe5100;
            font-size: 12px;            
    }
   
    .box_body{
        border-top: none;
    }
    .box_head{
        border-bottom: none;
        background: #fff1e6 none repeat scroll 0 0;
        color: #fe5100;
        border-color: #fe5100 #ffd5b3 #ffd5b3;
        border-width: 3px 1px 1px;
    }
    
    a:link{
        color: #666;
        font-size: 12px;
    }
</style>



<div class="m" style="width:1005px">
<?php 
    if ( !empty($displaySearchPanel) ) {
?>
    <div class="pos"><strong style="font-size:14px;color:#fe5100;" >搜索结果</strong></div>
    <div class="m_l_1 f_l" style="width:716px" >
<?php 
    } else {
?>
    <div class="m_l_1 f_l" style="width:1003px">
<?php 
    }
?>

	<div class="left_box">
           	<div class="fsearch" style="{$displaySearchPanel}">
                    <form action="{$MOD[linkurl]}search.php?searchtype=1" id="fsearch" >
                            
                        <table class="table-searchitem">
                            <tr>
                                <td style="padding:5px;padding-left:10px;"><strong>关 键 词：</strong></td>
                                <td style="padding:5px;padding-left:10px;"><input type="text" style="width:90%" name="kw" value="{$kw}" class="pd3"/></td>
                                <td rowspan="5" style="width:140px;padding:10px;border:solid 1px #DDDDDD;border-top:0; border-right:0;">
                                        <input type="hidden" id="searchtype" name="searchtype" value="1"  /> 
                                        <input type="hidden" id="filteraddress" name="areaid2" value="<?php echo $search_areatext; ?>" style="width:60px" /> 
                                        <input type="hidden" id="zp_category" name="zpcategory2" value="<?php echo $search_zpcategorytext; ?>" style="width:60px" />
                                        <input type="hidden" id="filtercategory" name="category2" value="<?php echo $search_filtercategorytext; ?>" style="width:60px" />
                                        <div class="search-item-btn"> 
                                            <button class="btn btn-primary">搜  索</button> 
                                            <!--
                                            <input type="image" src="{DT_SKIN}image/btn_search.gif"/>&nbsp;&nbsp;
                                            <a href="{$MOD[linkurl]}search.php"><img src="{DT_SKIN}image/btn_reset_search.gif"/></a>	
                                            -->
                                        </div>
                                    
                                </td>
                            </tr>
                            <!---->
                            <tr>
                                <td style="border-bottom:dotted 1px #a8a8a8;min-height:40px;padding:5px;padding-left:10px;"></td>
                                <td style="border-bottom:dotted 1px #a8a8a8;min-height:40px;padding:5px;padding-left:15px">
                                
                                    {loop $sfields $k $v}
                                    <input type="radio" name="fields" value="{$k}" id="fd_{$k}"{if $fields==$k} checked{/if}/><label for="fd_{$k}"> {$v}</label>&nbsp;
                                    {/loop}
                                    
                                    &nbsp;&nbsp;&nbsp;
                                    <!--<input type="radio" name="b_date" value=""         id="b_date0" {if $b_date==''} checked{/if}/><label for="b_date0">不限</label>&nbsp;                                    
                                    <input type="radio" name="b_date" value="day"      id="b_date1" {if $b_date=='day'}  checked {/if}/><label for="b_date1">近一天</label>&nbsp;-->
                                    <input type="radio" name="b_date" value="week"     id="b_date2" {if $b_date=='week'} checked {/if}/><label for="b_date2">近一周</label>&nbsp;
                                    <input type="radio" name="b_date" value="month"    id="b_date3" {if $b_date=='month'} checked {/if}/><label for="b_date3">近一月</label>&nbsp;
                                    <input type="radio" name="b_date" value="quarter"  id="b_date4" {if $b_date=='quarter'} checked {/if}/><label for="b_date4">近三月</label>&nbsp;
                                    <input type="radio" name="b_date" value="6month"   id="b_date5" {if $b_date=='6month'} checked {/if}/><label for="b_date5">近半年</label>&nbsp;
                                    <input type="radio" name="b_date" value="year"     id="b_date6" {if $b_date=='year'} checked {/if}/><label for="b_date6">近一年</label>&nbsp;
                                </td>
                            </tr>
                            
                            <tr>
                                <td style="border-bottom:dotted 1px #a8a8a8;min-height:40px;padding:5px;padding-left:10px;"><strong>服务区域：</strong></td>
                                <td style="border-bottom:dotted 1px #a8a8a8;min-height:40px;padding:5px;padding-top:0px;">
                                    <span class="piaochecked">
                                        <input type='checkbox' id='area0' name="area0" class='styled-checkbox' onclick='addDistrict(0);' {$area0_checked} />
                                        <label for='area0' style="font-weight:bold">全部</label>
                                    </span>
                                    <?php                 
                                        foreach( $user_areas as $area )
                                        {
                                            echo  '<span class="piaochecked">';
                                            echo  "<input type='checkbox' id='area" . $area["areaid"] . "' class='styled-checkbox area' onclick='addDistrict(" . $area["areaid"] . ");' ";
                                            if( !empty($area["checked"]) )
                                            {
                                               echo  "checked='"  . $area["checked"] . "'";
                                            }
                                            echo  " />";
                                            echo  "<label for='area" . $area["areaid"] . "'>" . $area["areaname"] . "</label>" ;
                                            echo '</span>';
                                        }                
                                    ?>
                                </td>
                                
                            </tr>
                            <tr>
                                <td style="border-bottom:dotted 1px #a8a8a8;min-height:40px;padding:5px;padding-left:10px;"> <strong>行业分类：</strong></td>
                                <td style="border-bottom:dotted 1px #a8a8a8;min-height:40px;padding:5px;padding-top:0px;">
                                    <span class="piaochecked">
                                        <input type='checkbox' id='cat_0' name="cat_0" class='styled-checkbox' onclick='addFilterCategory(0);' {$fcategory0_checked} />
                                        <label for='cat_0' style="font-weight:bold">全部</label>
                                    </span>
                                    <?php 
                                            foreach( $user_fcategories as  $index=>$fcategory )
                                            {                            
                                                if( !empty( $fcategory['child'] )) 
                                                {

                                                    echo  '<span class="piaochecked">';


                                                    echo  "<input type='checkbox' id='cat_" . $fcategory["id"] . "' class='styled-checkbox cat' onclick='addFilterCategory(" . $fcategory["id"] . ");' ";                        
                                                    if( !empty($fcategory["checked"]) )
                                                    {
                                                       echo  "checked='"  . $fcategory["checked"] . "'";
                                                    }
                                                    echo " />";


                                                    echo  '<label class="categoryList" for="cat_' . $fcategory["id"] . '" id="category'. $fcategory["id"] .'">';
                                                    echo  $fcategory["cat_name"] ;
                                                    echo  '</label>';                              
                                                    echo  '</span>';

                                                    echo "<script>";
                                                    echo "var catData" . $index . " = [";
                                                    foreach( $fcategory['child'] as $item )
                                                    {
                                                        echo '{ id: "cat_' .  $item['id'] . '", catid: "' . $item['id'] . '", label: "' . $item['cat_name'] . '", ';

                                                        if( !empty($item['checked']) )
                                                        {
                                                            echo ' isChecked: true ';
                                                        }
                                                        else
                                                        {
                                                            echo ' isChecked: false ';
                                                        }                                    
                                                        echo '}, ';
                                                    }
                                                    echo "]; ";                              
                                                    echo " $(document).ready( function(){ initCategory( '#category" . $fcategory["id"] . "', '" . $fcategory['cat_name'] . "', catData" . $index . " ); });";
                                                    echo "</script>";                                
                                                }
                                                else
                                                {
                                                    echo  '<span  class="piaochecked">';                                
                                                    echo  "<input type='checkbox' id='cat_" . $fcategory["id"] . "' class='styled-checkbox  cat' onclick='addFilterCategory(" . $fcategory["id"] . ");' ";                        
                                                    if( !empty($fcategory["checked"]) )
                                                    {
                                                       echo  "checked='"  . $fcategory["checked"] . "'";
                                                    }
                                                    echo " />";

                                                    echo  '<label for="cat_' . $fcategory["id"] . '" id="category'. $fcategory["id"] .'">';
                                                    echo  $fcategory["cat_name"] ;
                                                    echo  '</label>';                              
                                                    echo  '</span>';                                
                                                } 
                                            }
                                        ?>
                                </td>            
                            </tr>
                            <tr>
                                <td style="border-bottom:#DDDDDD 1px solid;min-height:40px;padding:5px;padding-left:10px;"><strong>招标分类：</strong></td>
                                <td style="border-bottom:#DDDDDD 1px solid;min-height:40px;padding:5px;padding-top:0px;">
                                    <span class="piaochecked">
                                        <input type='checkbox' id='catid0' name="catid0" class='styled-checkbox' onclick='addCategory(0);' {$category0_checked} />
                                        <label for='catid0' style="font-weight:bold">全部</label>
                                    </span>
                                    <?php  
                                        foreach( $user_categorys as $index=>$category )
                                        {
                                            echo  '<span class="piaochecked">';
                                            echo  "<input type='checkbox' id='catid" . $category["catid"] . "'  class='styled-checkbox zpcat' onclick='addCategory(" . $category["catid"] . ");' ";

                                            if( !empty($category["checked"]) )
                                            {
                                               echo  "checked='"  . $category["checked"] . "'";
                                            }
                                            echo " />";
                                            echo  "<label for='catid" . $category["catid"] . "'>" . $category["name"] . "</label>" ;
                                            echo  '</span>';
                                        }
                                    ?>
                                </td>
                            </tr>
                        </table>    
		{if $CP}
		{loop $PPT $p}
		<div class="ppt">
                    <table cellpadding="0" cellspacing="0" width="100%">
			<tr>
                            <td class="ppt_l" valign="top">按{$p[name]}</td>
                            <td class="ppt_r" valign="top">
                            <input type="hidden" name="ppt_{$p[oid]}" id="ppt_{$p[oid]}" value="{$p[select]}"/>
                            <a href="###" onclick="Dd('ppt_{$p[oid]}').value='';Dd('fsearch').submit();">{if $p[select]==''}<span>全部</span>{else}全部{/if}</a>
                            {loop $p[options] $o}
                            &nbsp;|&nbsp;<a href="###" onclick="Dd('ppt_{$p[oid]}').value='{$o}';Dd('fsearch').submit();">{if $p[select]==$o}<span>{$o}</span>{else}{$o}{/if}</a>
                            {/loop}
                            </td>
			</tr>
                    </table>
		</div>
		{/loop}
		{/if}
			</form>
		</div>
                <?php if ( empty($displaySearchPanel) ) { ?>
                <div class="pos"><strong style="font-size:14px;color:#fe5100;" >搜索结果</strong></div>
                <?php } ?>
		{if $tags}
		{template 'list-cat', 'tag'}
		{else}
		{template 'noresult', 'message'}
		{/if}
                
               
	</div>
</div>

<?php 
    if ( !empty($displaySearchPanel) ) {
?>
<div class="m_n f_l" >&nbsp;</div>
<div class="m_r_1 f_l" style="width:275px">
</div>

<?php 
    }
?>

</div>

<script>
  function list(size, checked) {
    var result = [];
    for (var i = 0; i < size; i++) {
      result.push({
        id: i,
        label: 'Item #' + i,
        isChecked: checked === undefined ? !!(Math.round(Math.random() * 1)) : checked
      });
    }
    return result;
  }





  function p(wat) {
    return '<p>' + JSON.stringify(wat) + '</p>';
  }

  function updateStatus() {
    var $p = $('p.status').empty();

    $p.append(p(widget.checked()));
    
  }

   function initCategory( catCtrlId, catCtrlName, catData)
   {
       $(catCtrlId).dropdownCheckbox({
            data: catData,
            autosearch: false,
            title: catCtrlName,
            hideHeader: true,
            showNbSelected: true,
            templateButton: '<a class="dropdown-checkbox-toggle" data-toggle="dropdown" href="#"> '+ catCtrlName +' <span class="dropdown-checkbox-nbselected"></span> &nbsp;<b class="caret"></b>'
          });
   }
   
   
  
  
function addCategory( categoryId )
{
    var itemText =  "(" + categoryId + ")" ;
    var filterValue = $('#zp_category').val();
    
    if( categoryId == 0 )
    {
        itemText = '(0)';
        $('#zp_category').val( itemText );       
        $(".zpcat").prop("checked", false); 
       $("#catid0").prop("checked", true);
        reuturn;
    }
    
    $("#catid0").prop("checked", false);     
    filterValue = filterValue.replace("(0)", "");
    var iPos = filterValue.indexOf(itemText);
    if( iPos < 0)
    {
        if( filterValue == '')
        {
            $('#zp_category').val( itemText );
        }
        else
        {
            filterValue = filterValue + "," +  itemText;
            filterValue = filterValue.replace(/,,/, ",");
            $('#zp_category').val( filterValue  );
        }
    }
    else
    {
         filterValue = filterValue.replace(itemText, "");         
         filterValue = filterValue.replace(/,,/, ",");        
         $('#zp_category').val(  filterValue );
    }
    
}

function addFilterCategory( categoryId )
{
    var itemText =  "(" + categoryId + ")" ;
    var filterValue = $('#filtercategory').val();
    
    if( categoryId == 0 )
    {
        itemText = '(0)';
        $('#filtercategory').val( itemText );       
        $(".cat").prop("checked", false); 
        $("#cat_0").prop("checked", true);
        reuturn;
    }
    
    $("#cat_0").prop("checked", false);     
    filterValue = filterValue.replace("(0)", "");
    
    
    
    
    
    var iPos = filterValue.indexOf(itemText);
    if( iPos < 0)
    {
        if( filterValue == '')
        {
            $('#filtercategory').val( itemText );
        }
        else
        {
            filterValue = filterValue + "," +  itemText;
            filterValue = filterValue.replace(/,,/, ",");
            $('#filtercategory').val( filterValue  );
        }
    }
    else
    {
         filterValue = filterValue.replace(itemText, "");         
         filterValue = filterValue.replace(/,,/, ",");        
         $('#filtercategory').val(  filterValue );
    }
}


function addDistrict(areaId)
{
    var itemText =  "(" + areaId + ")" ;
    var filterValue = $('#filteraddress').val();
    
    if( areaId == 0 )
    {
        itemText = '(0)';
        $('#filteraddress').val( itemText );       
        $(".area").prop("checked", false); 
        $("#area0").prop("checked", true);
        reuturn;
    }
    
    $("#area0").prop("checked", false);     
    filterValue = filterValue.replace("(0)", "");
    var iPos = filterValue.indexOf(itemText);
    if( iPos < 0)
    {
        if( filterValue == '')
        {
            $('#filteraddress').val( itemText );
        }
        else
        {
            filterValue = filterValue + "," +  itemText;
            filterValue = filterValue.replace(/,,/, ",");
            $('#filteraddress').val( filterValue  );
        }
    }
    else
    {
         filterValue = filterValue.replace(itemText, "");
         filterValue = filterValue.replace(/,,/, ",");        
         $('#filteraddress').val(  filterValue );
    }
}

$(document).ready( function() {
    $(".child-checkbox").on("click", function(){
        var catid = $(this).attr("catid");
        addFilterCategory(catid);
    });
});
  
  
  

</script>

{template 'footer'}
